package com.ctbri.gui;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;

import com.ctbri.util.SwingConsole;

public class Ex17 extends JFrame {
	
	JPasswordField passwordField = new JPasswordField(10);
	
	public Ex17() {
		setLayout(new FlowLayout());
		add(passwordField);
		passwordField.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				String password = new String(passwordField.getPassword());
				if(password.equals("dan"))
					JOptionPane.showMessageDialog(Ex17.this, 
							"The password is right",
							"Confirm", 
							JOptionPane.INFORMATION_MESSAGE);
				
			}
		});
	}
	

	public static void main(String[] args) {
		SwingConsole.run(new Ex17(), 500, 100);
	}

}
